{smcl}
{* 28dec2018}{...}
{hi:help linepalette}{...}
{right:{browse "http://repec.sowi.unibe.ch/stata/palettes/"}}
{right:{browse "http://github.com/benjann/palettes/"}}
{hline}

{title:Title}

{pstd}{hi:linepalette} {hline 2} Line pattern palettes


{marker syntax}{...}
{title:Syntax}

{pstd}
    Syntax 1: Retrieve (and display) a palette

{p 8 15 2}
    {cmd:linepalette} [{help linepalette##palette:{it:palette}}]
        [{cmd:,} {help linepalette##opts:{it:palette_options}}
        {help linepalette##gopts:{it:graph_options}} ]

{pstd}
    Syntax 2: Display multiple palettes

{p 8 15 2}
    {cmd:linepalette} [{cmd:,} {help linepalette##opts:{it:palette_options}}
        {help linepalette##gopts:{it:graph_options}} ] {cmd::} [ {it:list_of_palettes} ]

{pstd}
    where {it:list_of_palettes} is

{p 8 15 2}
    {help linepalette##palette:{it:palette}} [{cmd:,} {help linepalette##opts:{it:palette_options}}]
    [ {cmd:/} {help linepalette##palette:{it:palette}} [{cmd:,} {help linepalette##opts:{it:palette_options}}] {cmd:/} ... ]


{synoptset 20 tabbed}{...}
{marker palette}{synopthdr:palette}
{synoptline}
{syntab:Main ({stata "linepalette: default / pplain":{it:view}})}
{synopt:{helpb linepalette##default:default}}15 patterns as in Stata's monochrome schemes; the default{p_end}
{synopt:{helpb linepalette##pplain:pplain}}15 patterns as in {cmd:plotplain} by Bischof (2017){p_end}

{syntab:Custom}
{synopt:{help linepalette##patternlist:{it:patternlist}}}custom list of line patterns{p_end}
{synopt:{help linepalette##myname:{it:myname}}}custom palette provided by program {cmd:linepalette_}{it:myname}{p_end}
{synoptline}


{synoptset 20}{...}
{marker opts}{synopthdr:palette_options}
{synoptline}
{synopt:{helpb linepalette##n:n({it:#})}}specify size of palette (number of patterns)
    {p_end}
{synopt:{helpb linepalette##select:{ul:s}elect({it:numlist})}}select/order elements
    {p_end}
{synopt:{helpb linepalette##reverse:{ul:r}everse}}arrange palette in reverse order
    {p_end}
{synoptline}


{synoptset 20 tabbed}{...}
{marker gopts}{synopthdr:graph_options}
{synoptline}
{syntab:Main}
{synopt:{helpb linepalette##title:{ul:ti}tle({it:string})}}custom graph title
    {p_end}
{synopt:{helpb linepalette##lwidth:{ul:lw}idth({it:lwstyle})}}line thickness
    {p_end}
{synopt:{helpb linepalette##gropts:{ul:gr}opts({it:options})}}options to be
    passed through to the graph command
    {p_end}

{syntab:Syntax 1 only}
{synopt:{helpb linepalette##rows:rows({it:#})}}minimum number of rows; default is 5
    {p_end}
{synopt:{helpb linepalette##nograph:{ul:nogr}aph}}do not generate a graph
    {p_end}

{syntab:Syntax 2 only}
{synopt:{helpb linepalette##vertical:{ul:vert}ical}}vertical plot; the default
    {p_end}
{synopt:{helpb linepalette##horizontal:{ul:hor}izontal}}horizontal plot
    {p_end}
{synopt:{helpb linepalette##labels:{ul:lab}els({it:strlist})}}custom palette labels
    {p_end}
{synoptline}


{marker description}{...}
{title:Description}

{pstd}
    {cmd:linepalette} is a utility command to retrieve or display
    line pattern palettes. Palette entries are returned in
    {helpb linepalette##returns:r()}.

{pstd}
    {cmd:linepalette} is used by {helpb grstyle set}.


{marker options}{...}
{title:Options}

{dlgtab:Palette options}

{marker n}{...}
{phang}
    {opt n(#)} specifies the size of the palette (the number
    of elements). Typically this just selects the first {it:#} elements from the
    palette and is thus equivalent to {cmd:select(1/}{it:#}{cmd:)}.

{marker select}{...}
{phang}
    {opth select(numlist)} selects and orders the elements retrieved from
    the palette.

{marker reverse}{...}
{phang}
    {opt reverse} returns the palette in reversed order.

{dlgtab:Graph options}

{marker title}{...}
{phang}
    {opt title(string)} specifies a custom title for the graph.

{marker lwidth}{...}
{phang}
    {opth lwidth(linewidthstyle)} sets the line thickness. Default is
    {cmd:lwidth(medthick)}.

{marker gropts}{...}
{phang}
    {cmd:gropts(}{it:{help twoway_options}}{cmd:)} provides options to
    be passed through to the graph command.

{marker rows}{...}
{phang}
    {opt rows(#)} specifies the minimum number of rows in the graph (syntax 1
    only). The default is 5.

{marker nograph}{...}
{phang}
    {opt nograph} suppresses the graph (syntax 1 only).

{marker vertical}{...}
{phang}
    {opt vertical} displays the palettes vertically (syntax 2 only). This
    is the default.

{marker horizontal}{...}
{phang}
    {opt horizontal} displays the palettes horizontally (syntax 2 only).

{marker labels}{...}
{phang}
    {opt labels(strlist)} provides custom labels for the palettes (syntax 2
    only). Enclose labels with spaces in double quotes.

{marker palettes}{...}
{title:Palettes}

{marker default}{...}
{dlgtab:default}

{pstd}
    Palette {cmd:default} ({stata linepalette default:{it:view}}) contains the line patterns
    used for p1line to p15line or p1lineplot to p15lineplot in Stata's monochrome
    schemes. {cmd:default} is the default palette.

{marker pplain}{...}
{dlgtab:pplain}

{pstd}
    Palette {cmd:pplain} ({stata linepalette pplain:{it:view}}) contains the line patterns
    used for p1lineplot to p15lineplot in schemes {cmd:plotplain} and {cmd:plotplainblind}
    by {browse "http://www.stata-journal.com/article.html?article=gr0070":Bischof (2017)}.

{marker patternlist}{...}
{dlgtab:patternlist}

{pstd}
    Instead of using a named palette you can provide a custom palette by
    specifying a list of {help linepatternstyle:{it:linepatternstyles}}. Example:

        . {stata linepalette solid dash "--.." "--#"}

{marker myname}{...}
{dlgtab:myname}

{pstd}
    A personal named palette can be provided in form of a program called {cmd:linepalette_}{it:myname}, where
    {it:myname} is the name of the palette. Palette {it:myname} will then be available to
    {cmd:linepalette} like any other palette. Your program should return the line pattern definitions
    as a comma-separated list in local macro {cmd:P}. In addition you may provide a
    comma-separated list of descriptions in local macro {cmd:I}. Example:

        {com}program linepalette_morse
            c_local P .-###,-...###,-.-.###,-..###
            c_local I A,B,C,D
        end{txt}

{pstd}
    After defining the program, you can, for example, type

        {com}. linepalette morse{txt}

{pstd}
    to view the palette.


{marker examples}{...}
{title:Example}

        . {stata sysuse uslifeexp, clear}
        . {stata linepalette pplain, n(4) nograph}
        . {stata line le_wfemale le_wmale le_bfemale le_bmale year, lpattern(`r(p)')}


{marker returns}{...}
{title:Saved results}

{pstd}
    {cmd:linepalette} stores the following in {cmd:r()} (Syntax 1 only):

{synoptset 16 tabbed}{...}
{p2col 5 16 20 2: Scalars}{p_end}
{synopt:{cmd:r(n)}}number of returned palette entries{p_end}

{synoptset 16 tabbed}{...}
{p2col 5 16 20 2: Macros}{p_end}
{synopt:{cmd:r(ptype)}}{cmd:line}{p_end}
{synopt:{cmd:r(pname)}}name of palette{p_end}
{synopt:{cmd:r(pnote)}}additional information on palette (if provided){p_end}
{synopt:{cmd:r(p)}}space separated list of palette entries{p_end}
{synopt:{cmd:r(p#)}}#th palette entry{p_end}
{synopt:{cmd:r(p#info)}}info of #th palette entry (if provided){p_end}


{marker references}{...}
{title:References}

{phang}
    Bischof, D. 2017. {browse "http://www.stata-journal.com/article.html?article=gr0070":New graphic schemes for Stata: plotplain and plottig}.
    The Stata Journal 17(3): 748–759.
    {p_end}


{marker author}{...}
{title:Author}

{pstd}
    Ben Jann, University of Bern, ben.jann@soz.unibe.ch

{pstd}
    Thanks for citing this software as

{pmore}
    Jann, B. (2018). {browse "https://www.stata-journal.com/article.html?article=gr0075":Color palettes for Stata graphics}. The Stata Journal
    18(4): 765-785.

{pstd}
    or

{pmore}
    Jann, B. (2017). palettes: Stata module providing color palettes, symbol
    palettes, and line pattern palettes. Available from
    {browse "http://ideas.repec.org/c/boc/bocode/s458444.html"}.


{marker alsosee}{...}
{title:Also see}

{psee}
    Online:  help for {helpb colorpalette}, {helpb colorpalette9}, {helpb symbolpalette}, {helpb grstyle set}, {helpb graph}, {help linepatternstyle}

